﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MOD;
using PermissionBase.Core.Domain;
using PermissionBase.Core.Service;

public partial class pages_Bullitin_EditBullitin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            hfdPkid.Value = (string)Session["QueryString"];
            Session.Remove("QueryString");
            EBulletin eBulletin = new EBulletin();
            OaBulletin bulletin = eBulletin.GetBulletinInfo(hfdPkid.Value);
            if (bulletin != null)
            {
                this.txtTitle.Text = bulletin.BulletinTitle;
                this.txtExpiryDate.Text = bulletin.BulletinExpiryDate.ToShortDateString();
                this.txtContent.XMLNText = bulletin.BulletinContent;
            }
        }

    }


    protected void butSubmit_Click(object sender, EventArgs e)
    {
        string strTitle = txtTitle.Text;
        string strExpiryDate = Request.Form[txtExpiryDate.UniqueID];
        string strContent = txtContent.XMLNText;

        EBulletin eBulletin = new EBulletin();
        //此处应为当前登录人的CODE；
        Staff us = SessionUtil.GetLoginStaff();
        MOD.User user = new MOD.User();
        user.Emp_code = us.LoginId;
        int result = 0;
        result = eBulletin.UpdateBulletin(hfdPkid.Value, user, "", strTitle, strContent, strExpiryDate);
        if (result > 0)
        {
            Response.Write("<script>alert('操作成功!');location='SearchBullitin.aspx';</script>");
        }
        else
        {
            CommonComponent.WebPage.JScript.JsAlert("操作失败!");
        }
    }

   
}
